package com.example.demo.ObjectClone;

public class CloneTest {
   public static void cloneObject(){
       try{
           Person p1 = new Person("hhh",22,new Car("daZhong",150));
           Person p2 = MyUtil.clone(p1);
           p2.getCar().setBrand("baoMa");
           System.out.println(p1);
           System.out.println(p2);
       }catch(Exception e){
           e.printStackTrace();
       }
   }
}
